//
//  DaiLiTwoViewController.m
//  商城
//
//  Created by runone02 on 2018/9/28.
//  Copyright © 2018年 liqiyun. All rights reserved.
//

#import "DaiLiTwoViewController.h"

@interface DaiLiTwoViewController ()
@property (nonatomic, strong) UITextField *tx;
/** */
@property (nonatomic, strong) UIButton *btn;
@end

@implementation DaiLiTwoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    _tx = [[UITextField alloc] init];
    _tx.borderStyle = UITextBorderStyleRoundedRect;
    _tx.backgroundColor = [UIColor whiteColor];
    _tx.font = [UIFont systemFontOfSize:14];
    _tx.textColor = [UIColor darkGrayColor];
    _tx.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:_tx];
    
    [_tx mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.centerX.mas_equalTo(self.view);
        make.left.mas_equalTo(self.view).with.offset(30);
        make.right.mas_equalTo(self.view).with.offset(-30);
        make.height.mas_equalTo(30);
    }];
   
    
    
    self.btn = [[UIButton alloc] init];
    [self.btn setBackgroundColor:[UIColor lightGrayColor]];
    [self.btn setTitle:@"回传" forState:UIControlStateNormal];
    self.btn.titleLabel.font = [UIFont systemFontOfSize:14];
    self.btn.titleLabel.textAlignment = NSTextAlignmentCenter;
    [self.btn addTarget:self action:@selector(backActionClicked) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.btn];
    [self.btn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.tx.mas_bottom).with.offset(10);
        make.centerX.mas_equalTo(self.view);
        make.height.mas_equalTo(30);
        make.width.mas_equalTo(50);
    }];
}

- (void)backActionClicked{
    //当代理响应
    if ([_DaiLiTwoDelegate respondsToSelector:@selector(doset:)]) {
//        [_DaiLiTwoDelegate doset:_btn.titleLabel.text];
        [_DaiLiTwoDelegate doset:_tx.text];
        [self.navigationController popViewControllerAnimated:YES];
    }
}
@end
